package com.xst.action;

import java.util.ArrayList;
import java.util.List;

import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;

import com.opensymphony.xwork2.ActionSupport;
import com.xst.business.ProductDao;
import com.xst.business.impl.ProductDaoImpl;
import com.xst.model.Product;
import static com.opensymphony.xwork2.Action.*;

@Results( { @Result(name = SUCCESS, location = "/page/welcome.jsp") })
public class ProductAction extends ActionSupport {
	private static final long serialVersionUID = 8356644014501558637L;
	private ProductDao productDao;
	private List<List<Product>> resultList = null;

	@Override
	public String execute() throws Exception {
		resultList = new ArrayList<List<Product>>();
		List<Product> list = productDao.getall();
		resultList.add(list);
		return SUCCESS;
	}

	public ProductDao getProductDao() {
		return productDao;
	}

	public void setProductDao(ProductDao productDao) {
		this.productDao = productDao;
	}

	public List<List<Product>> getResultList() {
		return resultList;
	}

	public void setResultList(List<List<Product>> resultList) {
		this.resultList = resultList;
	}
}
